<template>
  <div>
    <!-- 弹出层的头部区域 -->
    <van-nav-bar id="colora" title="x条回复">
      <template #left>
        <van-icon name="arrow-left" size="0.7rem" color="black" @click="closePopUpFn"/>
      </template>
    </van-nav-bar>
    <!-- 评论 item -->
    <div class="cmt-item">
          <!-- 头部区域 -->
          <div class="cmt-header">
            <!-- 头部左侧 -->
            <div class="cmt-header-left">
              <img :src="src" alt="" class="avatar" />
              <span class="uname">{{ uname }}</span>
            </div>
            <!-- 头部右侧 -->
            <div class="cmt-header-right">
              <van-icon
                name="like"
                size="16"
                color="red"
                v-if="obj.is_liking === true"
                @click="likeFn(true, obj)"
              />
              <van-icon
                name="like-o"
                size="16"
                color="gray"
                v-else
                @click="likeFn(false, obj)"
              />
            </div>
          </div>
          <!-- 主体区域 -->
          <div class="cmt-body">
            {{ body }}
          </div>
          <!-- 尾部区域 -->
          <van-button
            round
            size="mini"
            color="#ccc"
            type="primary"
            @click="showPopup"
            >回复 ></van-button
          >
          <div class="cmt-footer">{{ timer }}</div>
        </div>
  </div>
</template>

<script>
// import { getCommentsListAPI } from '@/api'
export default {
  props: [
    'src',
    'uname',
    'body',
    'timer'

  ],
  data () {
    return {

    }
  },
  methods: {
    closePopUpFn () {
      this.$emit('closePE', false)
    }
  }
  // async created () {
  //   const res = await getCommentsListAPI({
  //     artId: this.artId,
  //     // offset: this.offset, // 把offset偏移量带给后台
  //     type: 'a',
  //     limit: 1
  //   })
  //   console.log(res)
  // }

}
</script>

<style  scoped lang="less">
.van-nav-bar #colora {
  background-color: #fff;
  color: black;
}
.cmt-list {
  padding: 10px;
  .cmt-item {
    padding: 15px 0;
    + .cmt-item {
      border-top: 1px solid #f8f8f8;
    }
    .cmt-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      .cmt-header-left {
        display: flex;
        align-items: center;
        .avatar {
          width: 40px;
          height: 40px;
          background-color: #f8f8f8;
          border-radius: 50%;
          margin-right: 15px;
        }
        .uname {
          font-size: 12px;
        }
      }
    }
    .cmt-body {
      font-size: 14px;
      line-height: 28px;
      text-indent: 2em;
      margin-top: 6px;
      word-break: break-all;
    }
    .cmt-footer {
      margin-left: 25px;
      display: inline-block;
      font-size: 12px;
      color: gray;
      margin-top: 10px;
    }
  }
}

</style>
